<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php $this->load->view('common/head'); ?>

<?php $this->load->view('common/header'); ?>
<div class="main-container" id="main-container">
    <script button="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar'); ?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs'); ?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set'); ?>

                <!-- /section:settings.box -->
                <div class="row">
                    <!-- PAGE CONTENT BEGINS -->
                    <form class="form-inline" action="" method="get">
<!--                        <label class="inline">客服名称:<input type="text" name="customer_title" id="customer_title"  value="--><?php //if (isset($search['keyword'])) {
//                                echo $search['keyword'];
//                            } ?><!--" /></label>-->
<!--                        <button type="submit" class="btn btn-purple btn-sm">-->
<!--                            <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>-->
<!--                            查询-->
<!--                        </button>-->
<!--                        <button type="button" class="btn btn-purple btn-sm" id="add">-->
<!--                            <span class="ace-icon fa fa-plus icon-on-right bigger-110"></span>-->
<!--                            新增-->
<!--                        </button>-->
                    </form>
                    <div class="space-4"></div>
                    <table class="table table-striped table-bordered">
                        <thead>
                        <tr>
                            <th width="15%" class="center">发布时间</th>
                            <th class="center">姓名</th>
                            <th class="center">电邮</th>
                            <th class="center">电话</th>
                            <th class="center">留言内容</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php  if ($customer) {
                            foreach ($customer as $key => $val) { ?>
                                <tr>
                                    <td class="center"><?php echo $val['time']; ?></td>
                                    <td class="center"><?php echo $val['name']; ?></td>
                                    <td class="center"><?php echo $val['email']; ?></td>
                                    <td class="center"><?php echo $val['tel']; ?></td>
                                    <td class="center"><?php echo $val['con']; ?></td>
<!--                                    <td class="center">-->
<!--                                        <a href="--><?php //echo site_url(X_URL . 'customer/edit/' . $val['id']); ?><!--">修改</a>&nbsp;-->
<!--                                        <a class="red del" href="javascript:;"-->
<!--                                           val="--><?php //echo site_url(X_URL . 'customer/del/' . $val['id']); ?><!--"-->
<!--                                           title="删除">删除</a>-->
<!--                                    </td>-->
                                </tr>
                            <?php } ?>
                        <?php } ?>
                        </tbody>
                    </table>
                    <?php if ($pagination) { ?>
                        <ul class="pagination"><?php echo $pagination; ?></ul><?php } ?>
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<?php $this->load->view('common/footer'); ?>
</div>


<?php $this->load->view('common/footerjs'); ?>
<!-- inline scripts related to this page -->
<script>
    $(".dellink").click(function () {
        var url = $(this).attr('val');
        bootbox.confirm({
            title: "系统提示",
            message: "是否要删除该记录？",
            callback: function (result) {
                if (result) {
                    window.location.href = url;
                }
            },
            buttons: {
                "cancel": {"label": "取消"},
                "confirm": {
                    "label": "确定",
                    "className": "btn-danger"
                }
            }
        });
    });
    $("#add").click(function () {
        window.location.href = "add";
    });
    //prompt层
    $(".add").click(function () {
        var pid = $(this).attr("pid");
        var url = $(this).attr("val");
        layer.prompt({title: '请填写该工种子类名称'}, function (value, index) {
            $.ajax({
                button: "post",
                url: url,
                data: {'pid': pid, 'name': value, 'csrf_test_name': ci_csrf_token()},
                dataType: "JSON",
                success: function (msg) {
                    if (msg.status == 1) {
                        layer.msg(msg.info, {
                            time: 1000, //1s后自动关闭
                            shade: 0.1
                        }, function () {
                            window.location.href = window.location.href;
                        });
                    } else {
                        layer.msg(msg.msg);
                        return false;
                    }
                }
            })
        });
    });
</script>
</body>
</html>
